+2003-09-07 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkuimanager.c (update_node): Fix a C99ism. (#121640,
+ Josh Beam)
+
+ Fixes for accelerator handling during (un)merging:
+
+ * gtk/gtkuimanager.c (update_node): Move setting info-action
+ after the switch, since the old action is needed in some cases.
+ In cases of proxy type mismatch, disconnect the old proxy from
+ the old action.
+
+ * gtk/gtkaction.c (remove_proxy): Renamed from
+ gtk_action_remove_proxy(). Move unsetting of the accelerator
+ here from disconnect_proxy() in order to catch all cases of
+ removing a proxy.
+ (gtk_action_disconnect_proxy): Fix logic in g_return_if_fail()
+ to fail if proxy isn't a proxy of action.
+
2003-09-07 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: Added Uzbek latin (uz) and cyrillic (uz@Cyrl) to
+2003-09-07 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkuimanager.c (update_node): Fix a C99ism. (#121640,
+ Josh Beam)
+
+ Fixes for accelerator handling during (un)merging:
+
+ * gtk/gtkuimanager.c (update_node): Move setting info-action
+ after the switch, since the old action is needed in some cases.
+ In cases of proxy type mismatch, disconnect the old proxy from
+ the old action.
+
+ * gtk/gtkaction.c (remove_proxy): Renamed from
+ gtk_action_remove_proxy(). Move unsetting of the accelerator
+ here from disconnect_proxy() in order to catch all cases of
+ removing a proxy.
+ (gtk_action_disconnect_proxy): Fix logic in g_return_if_fail()
+ to fail if proxy isn't a proxy of action.
+
2003-09-07 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: Added Uzbek latin (uz) and cyrillic (uz@Cyrl) to
+2003-09-07 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkuimanager.c (update_node): Fix a C99ism. (#121640,
+ Josh Beam)
+
+ Fixes for accelerator handling during (un)merging:
+
+ * gtk/gtkuimanager.c (update_node): Move setting info-action
+ after the switch, since the old action is needed in some cases.
+ In cases of proxy type mismatch, disconnect the old proxy from
+ the old action.
+
+ * gtk/gtkaction.c (remove_proxy): Renamed from
+ gtk_action_remove_proxy(). Move unsetting of the accelerator
+ here from disconnect_proxy() in order to catch all cases of
+ removing a proxy.
+ (gtk_action_disconnect_proxy): Fix logic in g_return_if_fail()
+ to fail if proxy isn't a proxy of action.
+
2003-09-07 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: Added Uzbek latin (uz) and cyrillic (uz@Cyrl) to
+2003-09-07 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkuimanager.c (update_node): Fix a C99ism. (#121640,
+ Josh Beam)
+
+ Fixes for accelerator handling during (un)merging:
+
+ * gtk/gtkuimanager.c (update_node): Move setting info-action
+ after the switch, since the old action is needed in some cases.
+ In cases of proxy type mismatch, disconnect the old proxy from
+ the old action.
+
+ * gtk/gtkaction.c (remove_proxy): Renamed from
+ gtk_action_remove_proxy(). Move unsetting of the accelerator
+ here from disconnect_proxy() in order to catch all cases of
+ removing a proxy.
+ (gtk_action_disconnect_proxy): Fix logic in g_return_if_fail()
+ to fail if proxy isn't a proxy of action.
+
2003-09-07 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: Added Uzbek latin (uz) and cyrillic (uz@Cyrl) to
+2003-09-07 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkuimanager.c (update_node): Fix a C99ism. (#121640,
+ Josh Beam)
+
+ Fixes for accelerator handling during (un)merging:
+
+ * gtk/gtkuimanager.c (update_node): Move setting info-action
+ after the switch, since the old action is needed in some cases.
+ In cases of proxy type mismatch, disconnect the old proxy from
+ the old action.
+
+ * gtk/gtkaction.c (remove_proxy): Renamed from
+ gtk_action_remove_proxy(). Move unsetting of the accelerator
+ here from disconnect_proxy() in order to catch all cases of
+ removing a proxy.
+ (gtk_action_disconnect_proxy): Fix logic in g_return_if_fail()
+ to fail if proxy isn't a proxy of action.
+
2003-09-07 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: Added Uzbek latin (uz) and cyrillic (uz@Cyrl) to
}
static void
-gtk_action_remove_proxy (GtkWidget *widget,
- GtkAction *action)
+remove_proxy (GtkWidget *proxy,
+ GtkAction *action)
{
- action->private_data->proxies = g_slist_remove (action->private_data->proxies, widget);
+ if (GTK_IS_MENU_ITEM (proxy))
+ gtk_menu_item_set_accel_path (GTK_MENU_ITEM (proxy), NULL);
+
+ action->private_data->proxies = g_slist_remove (action->private_data->proxies, proxy);
}
static void
/* add this widget to the list of proxies */
action->private_data->proxies = g_slist_prepend (action->private_data->proxies, proxy);
g_signal_connect (proxy, "destroy",
- G_CALLBACK (gtk_action_remove_proxy), action);
+ G_CALLBACK (remove_proxy), action);
g_signal_connect_object (action, "notify::sensitive",
G_CALLBACK (gtk_action_sync_property), proxy, 0);
/* remove proxy from list of proxies */
g_signal_handlers_disconnect_by_func (proxy,
- G_CALLBACK (gtk_action_remove_proxy),
+ G_CALLBACK (remove_proxy),
action);
- gtk_action_remove_proxy (proxy, action);
+ remove_proxy (proxy, action);
/* disconnect the activate handler */
g_signal_handlers_disconnect_by_func (proxy,
G_CALLBACK (gtk_action_sync_label),
proxy);
- if (GTK_IS_MENU_ITEM (widget))
- gtk_menu_item_set_accel_path (GTK_MENU_ITEM (widget), NULL);
-
/* toolbar button specific synchronisers ... */
g_signal_handlers_disconnect_by_func (action,
G_CALLBACK (gtk_action_sync_short_label),
g_return_if_fail (GTK_IS_ACTION (action));
g_return_if_fail (GTK_IS_WIDGET (proxy));
- g_return_if_fail (g_object_get_data (G_OBJECT (proxy), "gtk-action") != action);
+ g_return_if_fail (g_object_get_data (G_OBJECT (proxy), "gtk-action") == action);
(* GTK_ACTION_GET_CLASS (action)->disconnect_proxy) (action, proxy);
}
goto recurse_children;
}
- if (info->action)
- g_object_unref (info->action);
- info->action = action;
- if (info->action)
- g_object_ref (info->action);
-
switch (info->type)
{
case NODE_TYPE_MENUBAR:
GList *siblings;
/* remove the proxy if it is of the wrong type ... */
if (info->proxy && G_OBJECT_TYPE (info->proxy) !=
- GTK_ACTION_GET_CLASS (info->action)->menu_item_type)
+ GTK_ACTION_GET_CLASS (action)->menu_item_type)
{
prev_submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy));
if (prev_submenu)
g_object_ref (prev_submenu);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), NULL);
}
+ gtk_action_disconnect_proxy (info->action, info->proxy);
gtk_container_remove (GTK_CONTAINER (info->proxy->parent),
info->proxy);
info->proxy = NULL;
if (find_menu_position (node, &menushell, &pos))
{
- info->proxy = gtk_action_create_menu_item (info->action);
+ GtkWidget *tearoff;
+
+ info->proxy = gtk_action_create_menu_item (action);
menu = gtk_menu_new ();
- GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
+ tearoff = gtk_tearoff_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), menu);
gtk_menu_set_accel_group (GTK_MENU (menu), self->private_data->accel_group);
}
}
else
- gtk_action_connect_proxy (info->action, info->proxy);
+ gtk_action_connect_proxy (action, info->proxy);
if (prev_submenu)
{
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy),
!GTK_IS_SEPARATOR_MENU_ITEM (info->extra))
{
if (info->proxy)
- gtk_container_remove (GTK_CONTAINER (info->proxy->parent),
- info->proxy);
+ {
+ gtk_container_remove (GTK_CONTAINER (info->proxy->parent),
+ info->proxy);
+ info->proxy = NULL;
+ }
if (info->extra)
- gtk_container_remove (GTK_CONTAINER (info->extra->parent),
- info->extra);
- info->proxy = NULL;
- info->extra = NULL;
+ {
+ gtk_container_remove (GTK_CONTAINER (info->extra->parent),
+ info->extra);
+ info->extra = NULL;
+ }
}
if (info->proxy == NULL)
{
!GTK_IS_SEPARATOR_TOOL_ITEM (info->extra))
{
if (info->proxy)
- gtk_container_remove (GTK_CONTAINER (info->proxy->parent),
- info->proxy);
+ {
+ gtk_container_remove (GTK_CONTAINER (info->proxy->parent),
+ info->proxy);
+ info->proxy = NULL;
+ }
if (info->extra)
- gtk_container_remove (GTK_CONTAINER (info->extra->parent),
- info->extra);
- info->proxy = NULL;
- info->extra = NULL;
+ {
+ gtk_container_remove (GTK_CONTAINER (info->extra->parent),
+ info->extra);
+ info->extra = NULL;
+ }
}
if (info->proxy == NULL)
{
case NODE_TYPE_MENUITEM:
/* remove the proxy if it is of the wrong type ... */
if (info->proxy && G_OBJECT_TYPE (info->proxy) !=
- GTK_ACTION_GET_CLASS (info->action)->menu_item_type)
+ GTK_ACTION_GET_CLASS (action)->menu_item_type)
{
+ gtk_action_disconnect_proxy (info->action, info->proxy);
gtk_container_remove (GTK_CONTAINER (info->proxy->parent),
info->proxy);
info->proxy = NULL;
if (find_menu_position (node, &menushell, &pos))
{
- info->proxy = gtk_action_create_menu_item (info->action);
+ info->proxy = gtk_action_create_menu_item (action);
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
info->proxy, pos);
else
{
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), NULL);
- gtk_action_connect_proxy (info->action, info->proxy);
+ gtk_action_connect_proxy (action, info->proxy);
}
break;
case NODE_TYPE_TOOLITEM:
/* remove the proxy if it is of the wrong type ... */
if (info->proxy && G_OBJECT_TYPE (info->proxy) !=
- GTK_ACTION_GET_CLASS (info->action)->toolbar_item_type)
+ GTK_ACTION_GET_CLASS (action)->toolbar_item_type)
{
+ gtk_action_disconnect_proxy (info->action, info->proxy);
gtk_container_remove (GTK_CONTAINER (info->proxy->parent),
info->proxy);
info->proxy = NULL;
if (find_toolbar_position (node, &toolbar, &pos))
{
- info->proxy = gtk_action_create_tool_item (info->action);
+ info->proxy = gtk_action_create_tool_item (action);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
GTK_TOOL_ITEM (info->proxy), pos);
}
else
{
- gtk_action_connect_proxy (info->action, info->proxy);
+ gtk_action_connect_proxy (action, info->proxy);
}
break;
case NODE_TYPE_SEPARATOR:
break;
}
- /* if this node has a widget, but it is the wrong type, remove it */
+ if (action)
+ g_object_ref (action);
+ if (info->action)
+ g_object_unref (info->action);
+ info->action = action;
}
recurse_children: